/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package qrlogin.common;

import qrlogin.common.QRLoginParam;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author adee
 */
public class QRLoginParameters {
    private List<QRLoginParam> params;

    public QRLoginParameters() {
        this.params = new ArrayList<QRLoginParam>();
    }

    public String buildParameterXML(){
        StringBuilder result = new StringBuilder();
        result.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        result.append("\n<params>\n");
        for (QRLoginParam param : this.params){
            result.append("<param type=\""+param.getType()+ "\" name=\""+param.getName()+"\" humanname=\""+param.getHumanName()+"\">"+param.getValue()+"</param> \n");
        }
        result.append("</params>");

        return result.toString();

    }

    public void addParam(QRLoginParam param){
        this.params.add(param);
    }

}
